package cn.cdl.report.service.impl;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.cdl.report.dao.ChinaBankWuxiXinquMapper;
import cn.cdl.report.entity.ChinaBankWuxiXinqu;
import cn.cdl.report.service.ChinaBankWuxiXinquService;
import cn.cdl.report.util.CommonUtil;
import cn.cdl.report.util.DateUtil;


@Service("chinaBankWuxiXinquServiceImpl")
public class ChinaBankWuxiXinquServiceImpl implements ChinaBankWuxiXinquService {

	@Autowired
	ChinaBankWuxiXinquMapper chinaBankWuxiXinquMapper;
	
	@Override
	public void add(ChinaBankWuxiXinqu t) {
		chinaBankWuxiXinquMapper.add(t);
	}

	@Override
	public void del(ChinaBankWuxiXinqu t) {
		
	}

	@Override
	public void update(ChinaBankWuxiXinqu t) {
		
	}

	@Override
	public ChinaBankWuxiXinqu get(ChinaBankWuxiXinqu t) {
		return null;
	}

	@Override
	public List<ChinaBankWuxiXinqu> getList(ChinaBankWuxiXinqu t) {
		List<ChinaBankWuxiXinqu> list = chinaBankWuxiXinquMapper.getList(t);
		return list;
	}

	@Override
	public void batchInsert(List<String[]> list) {
		List<ChinaBankWuxiXinqu> l = new ArrayList<ChinaBankWuxiXinqu>();
		for(int i = 0 ; i < list.size() ; i++){
			if(i<=1){continue;} //从第三行开始读
			String[] a = list.get(i);
			ChinaBankWuxiXinqu cbwx = new ChinaBankWuxiXinqu();
            System.out.println("=====第【"+ i +"】行====="+a[0]);
			cbwx.setJyrq(DateUtil.StringToDate(a[0]));
            cbwx.setJiefang(CommonUtil.decimal(a[1]));
            cbwx.setDaifang(CommonUtil.decimal(a[2]));
            cbwx.setYongtu(a[3]);
            cbwx.setYongtu(a[5]);
            cbwx.setCzrq(new Date());
			l.add(cbwx);
		}
		chinaBankWuxiXinquMapper.batchInsert(l);
	}

}
